using System;
using uTILLIty.Rave.Contract.Configuration;

namespace uTILLIty.Rave.Contract.StorageAdapter
{
	/// <summary>
	/// A context-object holding the context of a given <see cref="Directory"/>
	/// </summary>
  public class DirectoryContext
  {
		/// <summary>
		/// Creates a new instance of the <see cref="DirectoryContext"/>
		/// </summary>
		/// <param name="directory">the directory object in question</param>
		/// <param name="parentDirectory">the <see cref="DirectoryContext"/> of the parent-directory</param>
    public DirectoryContext(Directory directory, DirectoryContext parentDirectory)
    {
      if (directory == null)
        throw new ArgumentNullException("directory");

      Directory = directory;
      ParentDirectory = parentDirectory;
    }

		/// <summary>
		/// The directory object in question
		/// </summary>
    public Directory Directory { get; protected set; }

		/// <summary>
		/// The <see cref="DirectoryContext"/> of the parent-directory
		/// </summary>
    public DirectoryContext ParentDirectory { get; protected set; }

		/// <summary>
		/// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
		/// </summary>
		/// <returns>
		/// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
		/// </returns>
		/// <filterpriority>2</filterpriority>
		public override string ToString()
    {
      return string.Format("{0}{1}\\", ParentDirectory != null ? ParentDirectory.ToString() : "", Directory.Name);
    }
  }
}